/*
 * @Author: 陈宇 975155172@qq.com
 * @Date: 2024-08-14 10:58:52
 * @LastEditors: 陈宇 975155172@qq.com
 * @LastEditTime: 2024-08-14 16:26:28
 * @FilePath: \blog-web\src\router\index.ts
 * @Description: 路由入口
 */
import { createRouter, createWebHistory } from 'vue-router';
import NProgress from 'nprogress'; // progress bar
import 'nprogress/nprogress.css';
import { appRoutes } from './routes/index';
import createRouteGuard from './guard';

NProgress.configure({ showSpinner: false }); // NProgress Configuration

const router = createRouter({
  history: createWebHistory(),
  routes: [
    {
      path: '/',
      redirect: '/blog',
    },
    ...appRoutes,
  ],
  scrollBehavior() {
    return { top: 0 };
  },
});

createRouteGuard(router);

export default router;
